/*
 * $Id: DirectionsStep.java 42 2013-04-17 15:33:59Z gabakyan $
 * $Author: gabakyan $
 * $Revision: 42 $
 * $Date: 2013-04-17 15:33:59 +0000 (Wed, 17 Apr 2013) $
 *
 * Copyright (c) 2013 Supply Chain Intelligence (SCI), Inc.
 * http://www.scintelligence.com/, Email: info@scintelligence.com
 * All rights reserved.
 *
 * This file is part of Logistics Map.
 *
 * Logistics Map is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * Logistics Map is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Logistics Map.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.sci.logisticsmap.support.model.geocoding;

import java.io.Serializable;

/**
 * The interface {@code DirectionsStep} represents the geocoding directions steps.
 *
 * @author gabakyan@gmail.com (Last modified by $Author: gabakyan $)
 * @version $Revision: 42 $
 */
public class DirectionsStep implements Serializable {
    /**
     * The serial version id.
     */
    private static final long serialVersionUID = 1L;

    /**
     * The travel mode.
     */
    private String travelMode;
    /**
     * The start location.
     */
    private LatLng startLocation;
    /**
     * The end location.
     */
    private LatLng endLocation;
    //"polyline": {
    //        "points": "a~l~Fjk~uOwHJy@P"
    //}
    /**
     * The duration.
     */
    private DirectionsDuration duration;
    /**
     * The html instructions.
     */
    private String htmlInstructions;
    /**
     * The distance.
     */
    private DirectionsDistance distance;

    /**
     * Gets the travel mode.
     *
     * @return The travel mode.
     */
    public String getTravelMode() {
        return travelMode;
    }

    /**
     * Sets the travel mode.
     *
     * @param travelMode The travel mode.
     */
    public void setTravelMode(String travelMode) {
        this.travelMode = travelMode;
    }

    /**
     * Gets the start location.
     *
     * @return The start location.
     */
    public LatLng getStartLocation() {
        return startLocation;
    }

    /**
     * Sets the start location.
     *
     * @param startLocation The start location.
     */
    public void setStartLocation(LatLng startLocation) {
        this.startLocation = startLocation;
    }

    /**
     * Gets the end location.
     *
     * @return The end location.
     */
    public LatLng getEndLocation() {
        return endLocation;
    }

    /**
     * Sets the end location.
     *
     * @param endLocation The end location.
     */
    public void setEndLocation(LatLng endLocation) {
        this.endLocation = endLocation;
    }

    /**
     * Gets the duration.
     *
     * @return The duration.
     */
    public DirectionsDuration getDuration() {
        return duration;
    }

    /**
     * Sets the duration.
     *
     * @param duration The duration.
     */
    public void setDuration(DirectionsDuration duration) {
        this.duration = duration;
    }

    /**
     * Gets the html instructions.
     *
     * @return The html instructions.
     */
    public String getHtmlInstructions() {
        return htmlInstructions;
    }

    /**
     * Sets the html instructions.
     *
     * @param htmlInstructions The html instructions.
     */
    public void setHtmlInstructions(String htmlInstructions) {
        this.htmlInstructions = htmlInstructions;
    }

    /**
     * Gets the distance.
     *
     * @return The distance.
     */
    public DirectionsDistance getDistance() {
        return distance;
    }

    /**
     * Sets the distance.
     *
     * @param distance The distance.
     */
    public void setDistance(DirectionsDistance distance) {
        this.distance = distance;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DirectionsStep that = (DirectionsStep) o;

        if (distance != null ? !distance.equals(that.distance) : that.distance != null) return false;
        if (duration != null ? !duration.equals(that.duration) : that.duration != null) return false;
        if (endLocation != null ? !endLocation.equals(that.endLocation) : that.endLocation != null) return false;
        if (htmlInstructions != null ? !htmlInstructions.equals(that.htmlInstructions) : that.htmlInstructions != null)
            return false;
        if (startLocation != null ? !startLocation.equals(that.startLocation) : that.startLocation != null)
            return false;
        if (travelMode != null ? !travelMode.equals(that.travelMode) : that.travelMode != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = travelMode != null ? travelMode.hashCode() : 0;
        result = 31 * result + (startLocation != null ? startLocation.hashCode() : 0);
        result = 31 * result + (endLocation != null ? endLocation.hashCode() : 0);
        result = 31 * result + (duration != null ? duration.hashCode() : 0);
        result = 31 * result + (htmlInstructions != null ? htmlInstructions.hashCode() : 0);
        result = 31 * result + (distance != null ? distance.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "DirectionsStep{" +
                "travelMode='" + travelMode + '\'' +
                ", startLocation=" + startLocation +
                ", endLocation=" + endLocation +
                ", duration=" + duration +
                ", htmlInstructions='" + htmlInstructions + '\'' +
                ", distance=" + distance +
                '}';
    }
}
